﻿using System;
using Nest;

namespace JobBatDeal.Model
{
    [ElasticsearchType(IdProperty = nameof(Id))]
    public class FanJiaHotel
    {
        public Guid Id { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 地址
        /// </summary>
        public string Address { get; set; }
        /// <summary>
        /// 电话
        /// </summary>
        public string Phone { get; set; }
        /// <summary>
        /// 经度
        /// </summary>
        public double? Longitude { get; set; }

        /// <summary>
        /// 纬度
        /// </summary>
        public double? Latitude { get; set; }

        /// <summary>
        /// 城市 ID
        /// </summary>
        public Guid CityId { get; set; }

        /// <summary>
        /// 供应商 ID
        /// </summary>
        public Guid SupplierId { get; set; }

        public GeoLocation HotelGeo
        {
            get
            {
                if (!Longitude.HasValue || !Latitude.HasValue)
                {
                    return null;
                }
                var geoLocation = GeoLocation.TryCreate(Latitude.Value, Longitude.Value) ?? GeoLocation.TryCreate(Longitude.Value, Latitude.Value);
                return geoLocation;

            }
        }

        public DateTime CreateDateTime { get; set; }
    }
}
